package com.example.aics.controller;
import org.springframework.web.bind.annotation.*;
import com.example.aics.assistant.XiaoZhiChatAssistant;
import com.example.aics.bean.ChatForm;

import jakarta.annotation.Resource;
import reactor.core.publisher.Flux;
/**
 * 小智医疗助手
 */
@RestController
@RequestMapping("/xiaozhi")
public class XiaozhiController {


    @Resource
    private  XiaoZhiChatAssistant xiaozhiChatAssistant;

    

    @PostMapping(value ="/chat",produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return xiaozhiChatAssistant.chat(chatForm.getMemoryId(),chatForm.getMessages());
    }

}